package com.atgenee;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.io.File;

@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter {

    @Value("${file.absoulatePath}")
    private String absoulatePath;

    @Value("${file.realPath}")
    private String realPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        System.out.println(absoulatePath);
        System.out.println(realPath);
        registry.addResourceHandler(realPath).addResourceLocations("file:" + File.separator + absoulatePath);
        super.addResourceHandlers(registry);
    }

}